﻿<%@ Page Title="" Language="VB" MasterPageFile="~/Views/Shared/Base.Master" Inherits="System.Web.Mvc.ViewPage(of DailyReport.LoginModel)" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Login
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h1>Daily Report</h1>
    <%--<h2>Powered by <%=Model.UserName %><a href="http://www.ext.net/">Ext.NET</a>, <a href="http://www.extjs.com/">ExtJS</a> and <a href="http://www.asp.net/mvc/">ASP.NET MVC</a></h2>--%>
    <ext:Window 
        ID="LoginWindow"
        runat="server" 
        Closable="false"
        Resizable="false"
        Height="130" 
        Icon="Lock" 
        Title="登录"
        Draggable="true"
        Width="300"
        Modal="true"
        Layout="fit"
        BodyBorder="false"
        Padding="5">        
        <Items>
                <ext:FormPanel ID="FormPanel1" 
                    runat="server" 
                    FormID="form1"
                    Border="false"
                    Layout="form"
                    BodyBorder="false" 
                    BodyStyle="background:transparent;" 
                    Url='<%# Html.AttributeEncode(Url.Action("Login")) %>'>
                    <Items>
                        <ext:TextField 
                            ID="Username" 
                            runat="server" 
                            FieldLabel="用户名/工号" 
                            AllowBlank="false"
                            BlankText="请输入用户名。"
                            AnchorHorizontal="100%"
                            ValidateOnBlur="true"
                            />
                         <ext:TextField 5
                            ID="Password" 
                            runat="server" 
                            InputType="Password" 
                            FieldLabel="密码" 
                            AllowBlank="false" 
                            BlankText="请输入密码。"
                            AnchorHorizontal="100%"
                            ValidateOnBlur="true"
                            />
                    </Items>
                </ext:FormPanel>
        </Items>
        <Buttons>
            <ext:Button ID="btnLogin" runat="server" Text="登录" Icon="Accept" Type="Submit" >
                <DirectEvents>
                    <Click 
                        Url="/Account/Login/" 
                        Timeout="60000"
                        FormID="form1"
                        CleanRequest="true" 
                        Method="POST"
                        Before="if (!FormPanel1.isValid()){return false;}
                            Ext.Msg.wait('正在认证...', '登录');"
                        Failure="Ext.Msg.show({
                           title:   'Login Error',
                           msg:     result.errorMessage,
                           buttons: Ext.Msg.OK,
                           icon:    Ext.MessageBox.ERROR
                        });">
                        <EventMask MinDelay="250" />
                        <ExtraParams>
                            <ext:Parameter Name="ReturnUrl" Value="Ext.urlDecode(String(document.location).split('?')[1]).r || '/'" Mode="Raw" />
                        </ExtraParams>
                    </Click>
                </DirectEvents>
            </ext:Button>
        </Buttons>
        <Listeners><AfterRender Handler="Username.focus();" /></Listeners>
    </ext:Window>
    <%--<ext:KeyMap ID="KeyMap1" runat="server" Target="={Ext.isGecko ? Ext.getDoc() : Ext.getBody()}">
        <ext:KeyBinding>
            <Keys>
                <ext:Key Code="ENTER" />
            </Keys>
            <Listeners>
            <Event Handler="" />
            </Listeners>
        </ext:KeyBinding>
        </ext:KeyMap>--%>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="HeaderArea" runat="server">
    <style type="text/css">
        h1 {
            font: normal 60px tahoma, arial, verdana;
            color: #E1E1E1;
        }
        
        h2 {
            font: normal 20px tahoma, arial, verdana;
            color: #E1E1E1;
        }
        
        h2 a {
            text-decoration: none;
            color: #E1E1E1;
        }
        
        .x-window-mc {
            background-color : #F4F4F4 !important;
        }
    </style>
    <script type="text/javascript">
        if (window.top.frames.length !== 0) {
            window.top.location = self.document.location;
        }
    </script>
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="StartupArea" runat="server">
    <script type="text/javascript" language="javascript">
        Ext.onReady(function () {
            //debugger;
            if (Username.getValue() == "") {
                Username.focus(true, true);
            } else if (Password.getValue() == "") {
                Password.focus(true, true);
            } else {
                btnLogin.focus(true, true);
            }
        });
    </script>
</asp:Content>
